import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_ohos/app/common/widgets/toast.dart';
import 'package:flutter_ohos/app/modules/counter_method_channel.dart';
import 'package:flutter_ohos/app/network/http_api.dart';
import 'package:flutter_ohos/app/network/http_manage.dart';
import 'package:flutter_ohos/app/routes/app_routes.dart';
import 'package:flutter_ohos/app/utils/log_utils.dart';
import 'package:get/get.dart';

import 'mine_state.dart';
import 'model/login_user_data_entity.dart';

class MineProvider extends ChangeNotifier {
  final state = MineState();

  ///初始化数据
  void initData() {
    print("初始化mine");
  }

  void changeTitle(String title) {
    LogUtils.d("changeTitle = ${title}");
    state.curTitle = title;
    notifyListeners();
  }

  ///跳转
  void jumpToFourthPage(String title) {
    LogUtils.d("jumpToFourthPage = ${title}");
    Get.toNamed(Routes.FOURTHVIEW,arguments: {"title":title});
  }

  ///跳转
  void jumpToFivePage() {
    Get.toNamed(Routes.FIVEVIEW);

  }

  void jumpToSixPage() {
    Get.toNamed(Routes.SIXVIEW, arguments: {"title": "six"});
  }

  void jumpToSevenPage() {
    Get.toNamed(Routes.SEVENVIEW, arguments: {"title": "seven"});
  }

  ///手机验证码登录接口
  void onSMSLogin() {
    var params = {
    };
    HttpManage.getInstance().post(
      HttpApi.passwordLogin,
      params,
      onSuccess: (data) {
        // var user = LoginUserDataEntity.fromJson();
        if (data == 'ok') {
          showToast("登录成功");
        }
      },
      onError: (errorCode, errorMessage) => {
        showToast(errorMessage),
      },
    );
  }
}
